package com.mutual.assistance.user.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mutual.assistance.user.model.po.UserPO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface UserMapper extends BaseMapper<UserPO> {
    @Update("update user set credit = credit + #{credit} where username = #{username}")
    int rollbackCredit(@Param("username") String username, @Param("credit") Integer credit);

    @Update("update user set credit = credit - #{credit} where username = #{username}")
    int subscriberUserCredit(@Param("username") String username, @Param("credit") Integer credit);

    @Update("update user set star = (star + #{star}) / 2 where username = #{username}")
    int updateUserStar(@Param("username") String username, @Param("star") Integer star);
}
